package Processes;

import threadedSimulator.Cpu;



/**
 * processor abstract super class
 * @author
 * @version 3/11/2014
 */
public abstract class Processes  implements ProcessesInterface {

    /**
     * priority of the process.
     */
	public int my_priority;
	
        /**
         * the cpu that is being worked on.
         */
	public Cpu my_cpu;
	
        /**
         * has the process finished.
         */
        public boolean has_finished = false;
		
        /**
         * the name of the process.
         */
	public String my_name;
        
        /**
         * is the process running.
         */
        public boolean running = false;
        
        /**
         * the number of times each processor loop runs before resetting.
         */
        static final int MAX_VALUE = 1000;
		
        /**
         * where the loop currently is.
         */
	public int my_current_index = 0;
	
        /**
         * runnable if true blocked if false.
         */
	public boolean can_run = true;

	/**
         * the constructor.
         * @param the_cpu the cpu
         * @param the_numberof_pro_con the number of producers and consumers.
         * @param the_name the name of the process.
         */
	public Processes(Cpu the_cpu, String the_numberof_pro_con, String the_name) {
		my_cpu = the_cpu;
		setName(the_name);
                
	}

	/**
         * sets the name
         * @param the_name the name of the process.
         */
	public void setName(String the_name)
	{
		my_name = the_name;
	}
	
        /**
         * gets the name of the process.         
         */
	public String getName()
	{
		return my_name;	
	}
	
        /**
         * to string.
         * @return string representation of the process.
         */
	@Override
	public String toString()
	{
		return my_name;
	}
}
